<?php
namespace App\Console\Commands\Tasks\Data;

use Illuminate\Console\Command;

class PlatformKeepStatistics extends Command
{
    protected $signature = 'task:platform_keep';

    protected $description = '按照每日每周每时间区间统计数据';

    // 业务处理
    public function handle()
    {
        //前一天
        $start_time = strtotime(date('Y-m-d'))-86400;
        $end_time = strtotime(date('Y-m-d'));
        app('repo_account_check')->account_remain($start_time,$end_time,1);

        //当前日期是周一,时间周期是上周
        if ((int)date('N')===1){
            $start_time = strtotime(date('Y-m-d')) - 86400*7;
            app('repo_account_check')->account_remain($start_time,$end_time,2);
        }
        //当前日期是1号,时间周期是上月
        if ((int)date('j')===1){
            $start_time = mktime(0,0,0,date("n")-1,1,date("Y"));
            app('repo_account_check')->account_remain($start_time,$end_time,3);
        }

    }
}